<script>
export default {
  name: "HomeView",
  methods: {
    logout() {
      // 将路由跳转至  /login
      this.$message({
        message: "即将退出",
        type: 'success',
        onClose: () => {
          this.$router.push('/login')
        }
      })
    }
  }
}
</script>

<template>
  <div id="container">
    <h1>
      <span>欢迎使用学生信息管理系统</span>
      <div id="logout">
        <el-button type="primary" plain size="small" circle @click="logout">退出</el-button>
      </div>
    </h1>
    <nav>
      <router-link to="/home/user">用户管理</router-link>
      |
      <router-link to="/home/student">学生管理</router-link>
    </nav>
    <hr>
    <!--      二级路由出口-->
    <router-view></router-view>
  </div>
</template>

<style scoped>
nav {
  padding: 30px;
}

nav a {
  font-weight: bold;
  color: #2c3e50;
}

nav a.router-link-exact-active {
  color: #42b983;
}

h1 {
  background-color: #42b983;
  box-sizing: border-box;
  padding-right: 30px;
}

#logout {
  display: inline-block;
  float: right;
}
</style>